import chalk from 'chalk'
import _ from 'lodash'

const log = console.log

function lablog(colorFunc) {
    return function(...message) {
        log(` ${colorFunc(message)} `)
    }
}

const article = lablog(chalk.white.bgGreen.underline.bold)
const desc = lablog(chalk.white.bgGray.underline)
const section = _.curry(function(title, sectionFunc) {
    console.group(chalk.white.bgBlueBright(` ${title} `))
    sectionFunc()
    console.groupEnd()
})

const codelog = lablog(chalk.white.underline)
const descFunc = function() {
    return function(expression) {
        codelog(`${expression} = ` + eval(expression))
    }
}
export {
    article,
    desc,
    section,
    descFunc,
}